exports.__esModule = true;

function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }

exports.default = class extends think.BaseController {
    /**
     * 得到所需统计的部门
     *
     * @returns
     */
    getStaticsOrgListAction() {
        var _this = this;

        return _asyncToGenerator(function* () {
            let module = _this.post("module");
            const StaticsOrgService = _this.service("temp/StaticsOrgService");
            const res = yield StaticsOrgService.getStaticsOrgList(module);
            if (res.error) {
                return _this.errorJson('查询失败');
            } else {
                return _this.successJson(res);
            }
        })();
    }
    /**
     * 得到所需统计的部门
     *
     * @returns
     */
    upsertStatisticsOrgAction() {
        var _this2 = this;

        return _asyncToGenerator(function* () {
            let data = _this2.post("module,org_id");
            const StaticsOrgService = _this2.service("temp/StaticsOrgService");
            const res = yield StaticsOrgService.upsertStaticsOrg(data);
            if (res.error) {
                return _this2.errorJson('保存失败');
            } else {
                return _this2.successJson('保存成功');
            }
        })();
    }

};